# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_pyname=colorclass
pkgname=python-colorclass
pkgver=2.2.2
pkgrel=2
pkgdesc='Yet another ANSI color text library for colorful worry-free console applications'
url='https://github.com/matthewdeanmartin/colorclass'
arch=('any')
license=('MIT')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-poetry-core')
checkdepends=('python-pytest' 'python-docopt')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/matthewdeanmartin/colorclass/archive/v${pkgver}.tar.gz
        $pkgname-poetry-core.patch::https://github.com/matthewdeanmartin/colorclass/pull/2.patch)
sha512sums=('c38b58d4122e794654a8ac71adb2be0fb679eb10bd70c9d8f5dee06b3c978c1530bb3fb8fd6530d88aa35311a46a2590b709e4dcc6e3a81d14b90bf8cb74ebc1'
            'd7806ffb6356ef4b9ac12526df316066fa0d79ba259acc10f09c27e241079914cce93f2666f89007ed7517a0ba3b4eaf61a33020ce025c2609bf1641078147c1')

prepare() {
  cd ${_pyname}-${pkgver}
  patch -p1 -i ../$pkgname-poetry-core.patch
}

build() {
  cd ${_pyname}-${pkgver}
  python -m build -wn
}

check() {
  cd ${_pyname}-${pkgver}
  pytest
}

package() {
  cd ${_pyname}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.md example.py -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
